<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<div th:fragment="public_btn">
    <script id="function_tpl" type="text/html">
        <div>
            {{#
                var createBtn = function(item,row){
                    var btn='';
                    var button = ''
                                +'<a class="layui-btn layui-btn-sm layui-btn-warm" lay-event="'+item.event+'">'
                                +item.name
                                +'</a>';
                    if(item.name=='禁用'){
                        if(( row.jhzt==1 )){
                            btn=button;
                        }
                    }else if(item.name=='启用'){
                        if( row.jhzt!=1 ){
                            btn=button;
                        }
                    }else{
                        btn=button;
                    }
                    return btn;
                }
            }}

            {{# layui.each(d.functions, function(index, item){ }}
                {{# if(d.row != undefined && d.row !=null && !jQuery.isEmptyObject(d.row)){ }}
                    {{# if(d.functions.length>1 && index==0){ }}
                        <a class="tooltip2" id="tooltip{{d.row.id}}" data-tooltip-content="#tool{{d.row.id}}" id="btn_start"><i class="layui-icon layui-icon-more"></i></a>
                        <div class="tooltip_templates">
                            <span id="tool{{d.row.id}}">
                            {{ createBtn(item,d.row) }}
                    {{# }else{ }}
                            {{ createBtn(item,d.row) }}
                    {{#} if(d.functions.length>1 && index==d.functions.length-1){ }}
                            </span>
                        </div>
                    {{# } }}
                {{# }else{ }}
                    {{# if(index <=4){ }}
                        {{# if(item.name=='新增'){ }}
                        <a class="layui-btn layui-btn-sm layui-btn-normal add-btn" lay-event={{ item.event }}>
                            <i class="layui-icon">&#x1005;</i>{{ item.name }}
                        </a>
                        {{# }else if(item.name=='修改'){ }}
                            <a class="layui-btn layui-btn-sm layui-btn-normal edit-btn" lay-event={{ item.event }}>
                                <i class="layui-icon">&#x1005;</i>{{ item.name }}
                            </a>
                        {{# }else if(item.name=='删除'){ }}
                            <a class="layui-btn layui-btn-sm layui-btn-normal delete-btn" lay-event={{ item.event }}>
                                <i class="layui-icon">&#x1005;</i>{{ item.name }}
                            </a>
                        {{# }else if(item.name=='导出'){ }}
                            <a class="layui-btn layui-btn-sm layui-btn-normal out-put" lay-event={{ item.event }}>
                                <i class="layui-icon">&#x1005;</i>{{ item.name }}
                            </a>
                        {{# }else{ }}
                            <a class="layui-btn layui-btn-sm layui-btn-normal delete-btn" lay-event={{ item.event }}>
                                <i class="layui-icon">&#x1005;</i>{{ item.name }}
                            </a>
                        {{# } }}
                    {{# }else{ }}
                        {{# if(index==5){ }}
                            <div class="btn-group1">
                                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                    aria-haspopup="true" aria-expanded="false">
                                    更多操作 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a class="layui-btn" href="#" lay-event={{ item.event }}>{{ item.name }}</a></li>
                        {{# }else{  }}
                                    <li><a class="layui-btn" href="#" lay-event={{ item.event }}>{{ item.name }}</a></li>
                        {{# } if(index==d.functions.length-1){ }}
                                </ul>
                            </div>
                        {{# } }}
                    {{# } }}
                {{# } }}
            {{# }); }}
        </div>

    </script>
</div>
</html>